import {request} from '@/plugins/axios'

export function login(data) {
    return request({
        url: '/easybuy/login',
        method: 'post',
        data
    })
}

export function sendValidCode(data) {
    return request({
        url: '/easybuy/sms/send/' + data.phoneNumber,
        method: 'get'
    })
}

export function smsLogin(data) {
    return request({
        url: '/easybuy/sms/login',
        method: 'post',
        params: data
    })
}

export function snsLogin(query) {
    let url = '/easybuy/sns/' + query.platformName + '/snsLogin'
    if (query.platformName == 'dingtalk') {
        url = '/easybuy/sns/snsLogin/dingtalk'
    }
    return request({
        url: url,
        method: 'get',
        params: query
    })
}